public class 外观模式 {
    public static void main(String[] args) {
        smartHomeFacade facade = new smartHomeFacade();
        facade.openAll();
        facade.closeAll();

    }
}

// 子系统类：灯光控制
class Light {
    public void turnOn() {
        System.out.println("灯光已打开");
    }

    public void turnOff() {
        System.out.println("灯光已关闭");
    }
}

// 子系统类：电视控制
class TV {
    public void turnOn() {
        System.out.println("电视已打开");
    }

    public void turnOff() {
        System.out.println("电视已关闭");
    }
}

// 子系统类：空调控制
class AirConditioner {
    public void turnOn() {
        System.out.println("空调已打开");
    }

    public void turnOff() {
        System.out.println("空调已关闭");
    }
}

class smartHomeFacade{

    private Light light;
    private TV tv;
    private AirConditioner ac;
    public  smartHomeFacade() {
        light = new Light();
        tv = new TV();
        ac = new AirConditioner();
    }
    //一键开启
    public void openAll() {
        System.out.println("开启所有设备...");
        light.turnOn();
        tv.turnOn();
        ac.turnOn();
    }
    //一键关闭
    public void closeAll() {
        System.out.println("关闭所有设备...");
        light.turnOff();
        tv.turnOff();
        ac.turnOff();
    }

}